<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
if($_RQ['op']=='main'){
	$return['params']=$params=array('uniacid'=>$_SESSION['uniacid'],);
	if($_RQ['mid']){
		$params['mid']=intval($_RQ['mid']);
		$return['params']['mid']=$_RQ['mid'];
	}
	if($_RQ['pid']){
		$params['pid']=intval($_RQ['pid']);
		$return['params']['pid']=$_RQ['pid'];
	}
	if($_RQ['status']){
		if(intval($_RQ['status']) ==10){
			$params['status']=0;
		}else{
			$params['status']=intval($_RQ['status']);
		}
		$return['params']['status']=$_RQ['status'];
	}
	if($_RQ['goodsid']){
		$params['goodsid']=intval($_RQ['goodsid']);
		$return['params']['goodsid']=$_RQ['goodsid'];
	}
	if($_RQ['createtime']){
		$time_range=cfc('tools')->base64_decode($_RQ['createtime'],$_SESSION['base_key_str']);
		$time_range=json_decode($time_range,true);
		$return['params']['createtime']=$time_range;
		$params['createtime between']=array($time_range['tstart'],$time_range['tend']);
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 20;
	$total='';
	$take=pdo_getslice('jy_jdpm_freezelog',$params,array($pindex,$psize),$total,$fields,'','createtime desc');
	foreach($take as &$v){
		$v['remarks']= $v['remarks'] ? $v['remarks'] : '缴纳保证金';
		$v['id'] = $v['createtime'];
	}
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$return['list']=$take;
	$htmls=array(
		'type'=>'list',
		'tabs'=>array(
			array('op'=>'list','title'=>'现金记录'),
		),
		'list'=>array('data'=>'list','edit'=>false,'del_one'=>false,'delall'=>false,'list'=>array(
			array('name'=>'mid','title'=>'用户uid','type'=>'string'),
			array('name'=>'pid','title'=>'拍卖PID','type'=>'string'),
			array('name'=>'pledge','title'=>'金额','type'=>'string'),
			array('name'=>'createtime','title'=>'创建时间','type'=>'createtime'),
			array('name'=>'rtime','title'=>'处理时间','type'=>'createtime'),
			//array('name'=>'rtime','title'=>'处理时间2','type'=>'string'),
			array('name'=>'status','title'=>'状态','type'=>'radio','options'=>'status'),
		),
		
		),
		'search'=>array(
			array('type'=>'string','width'=>'15','title'=>'用户UID','name'=>'mid','help'=>''),
			array('type'=>'string','width'=>'15','title'=>'拍品PID','name'=>'pid','help'=>''),
			array('type'=>'string','width'=>'15','title'=>'商品ID','name'=>'goodsid','help'=>''),
			array('type'=>'select','width'=>'15','title'=>'状态','name'=>'status','options'=>'status2','select_title'=>'请选择状态'),
			array('type'=>'time_range','width'=>'16','title'=>'申请时间','name'=>'createtime','help'=>''),
		),
	);
	$return['status']=array('0'=>'冻结中','1'=>'已解冻','2'=>'提现出金','3'=>'违约出金');
	$return['status2']=array(array('id'=>10,'title'=>'冻结中'),array('id'=>1,'title'=>'已解冻'),array('id'=>2,'title'=>'已出金'),array('id'=>3,'title'=>'违约出金'));
	$return['htmls']=$htmls;
	exi($return);	
}
if($_RQ['op']=='del'){
	$time=intval($_RQ['id']);
	if($time){
		pdo_delete('jy_jdpm_freezelog',array('uniacid'=>$_SESSION['uniacid'],'createtime'=>$time));	
	}
	exi('删除成功！');
}